﻿using StreamServeDSIGenerator.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace StreamServeDSIGenerator.Business.ControlClass
{
    public class UpdateMainControl
    {
        public ListBox TemplateListBox { set; get; }
        public Button btnAddUpdate { set; get; }
        public TextBox txtTemplate { set; get; }

        public void TemplateListBoxSelectedIndexChanged(List<DataTemplate>DataTemplateProvided)
        {
            if (DataTemplateProvided.Count > 0 && TemplateListBox.Items.Count > 0 && TemplateListBox.SelectedIndex >= 0)
            {
                txtTemplate.Text = DataTemplateProvided[TemplateListBox.SelectedIndex].DataTemplateText;
                btnAddUpdate.Enabled = false;
            }
            else
            {
                btnAddUpdate.Enabled = true;
            }
        }
    }
}
